home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15257 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news.gate.net!rdl-ilps-rxh2
  2. From: rmcinnis@gate.net (Robert B McInnis)
  3. Newsgroups: comp.lang.c++
  4. Subject: Additions to the STL : Callback/Observer pair
  5. Date: 4 Apr 1996 14:31:55 GMT
  6. Organization: 9th Bit Software
  7. Message-ID: <4k0mgr$1iog@news.gate.net>
  8. NNTP-Posting-Host: miafl2-31.gate.net
  9. X-Newsreader: News Xpress Version 1.0 Beta #4
  10.  
  11.  
  12. I would like to propose a Callback/Observer construct for the Standard 
  13. Template Library.  This could be a base class pair with the Observer being 
  14. primarily templates.  This would allow for a consistent Callback/Observer 
  15. pattern to be used across applications.  This would also familiarize people 
  16. with the pattern and promote different design decisions when designing an app.
  17.  
  18. The Callback class should be a simple list of Observers that the owner, or 
  19. possibly anyone, depending on access, would be able to invoke or disable.
  20.  
  21. An Observer should be dynamic enough so that if the receiver instance, that is 
  22. attached directly to the Observer instance, were to be deleted, then the 
  23. Observer object would know to just disable its node on its associated Callback 
  24. list.
  25.  
  26. This would lead to the concept of Observible destruction of objects.
  27.  
  28. What about observible construction on a class.  This would allow my class to 
  29. know when an instance of itself has been created, then fire off an initialize 
  30. VIRTUAL, since this really can't be done in the constructor without EVERY 
  31. descendent having to know about the initialize method.
  32.  
  33. This would eventually allow for observible files on a file system.  Imagine 
  34. that!  Biff would be a trivial app (even on DOS) without a polling mechanism.  
  35. Or maybe just for version control, to know when certain files have updated on 
  36. a LARGE network based development effort.
  37.  
  38. Just a thought.  If anyone is actually listening, it'd be nice to know what's 
  39. thought of this.  Need an example of a callback/observer pair?  Just eMail me.
  40.  
  41. Thanks for the time,
  42.  
  43. Rob
  44.  
  45. ---------------------------
  46. Robert McInnis
  47. 9th Bit Software
  48. (eMail)  rmcinnis@gate.net
  49. (web  )  http://www.gate.net/~rmcinnis
  50.  
  51.